<template>
  <el-row v-loading="loading">

              <el-input  v-model="search.name" placeholder="请输入身份证查询"  style="width:200px;margin-left:20px"></el-input>

      <el-col :span="24">
              <member-data ref="memberData"></member-data>
              <show-dyinfo ref="showDyinfo"></show-dyinfo>
              <el-table
              :data="searchmember(search.name).slice((search.currentPage-1)*search.limit,search.currentPage*search.limit)"
              border
              style="width: 100%">

                  <el-table-column
                    fixed
                    prop="tableData.fileNumber"
                    label="档案号">
                  </el-table-column>

                  <el-table-column
                    prop="tableData.name"
                    label="姓名">
                  </el-table-column>

                   <el-table-column
                    label="性别">
                    <template slot-scope="scope">
                    <span v-if="scope.row.sex=='0'">男</span>
                    <span v-else>女</span>
                    </template>
                  </el-table-column>

                  <el-table-column
                    prop="tableData.age"
                    label="最后操作时间">
                  </el-table-column>

                  <el-table-column
                    prop="interposeClassify.status"
                    label="报告状态">
                  </el-table-column>

                  <el-table-column
                    prop="tableData."
                    label="健康管理师">
                  </el-table-column>

                  <el-table-column
                    fixed="right"
                    label="操作"
                    width="200">
                    <template slot-scope="scope">
                      <el-button @click="handleClick(scope.row,'info')" type="primary" v-if="scope.row.reportStatus=='1'" size="small" icon="el-icon-search">查看</el-button>
                      <el-button @click="handleClick(scope.row,'view')" type="primary" v-else size="small">体检</el-button>
                    </template>
                  </el-table-column>
            </el-table>
      </el-col>

        <el-col :span="24">
          <el-pagination
            @size-change="handleSizeChange"
            :current-page.sync="search.currentPage"
            :page-sizes="[5, 8, 10]"
            :page-size="search.limit"
            layout="total, sizes, prev, pager, next, jumper"
            :total="searchtotal()">
          </el-pagination>
        </el-col>
  </el-row>
</template>

<script>
export default {
data(){
      return{
        loading:false,
        search:{
          name:"",
          sort:"",
          offset:0,
          limit: 5,
          currentPage: 1,
          total:0
        },
        tableData:[],
      }
    },
    methods:{
      handleSizeChange(val){
       this.search.limit = val;
    },
      searchtotal(){
        return this.searchmember(this.search.name).length;
     },
      searchmember(val){
      return this.tableData.filter(function (item) {
          if(item.tmember.idCard.search(val)>=0){
            return item;
          }
      })
    }
    }
}
</script>

<style>

</style>
